import { MigrationInterface, QueryRunner } from "typeorm";

export class All1746791634135 implements MigrationInterface {
    name = 'All1746791634135'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`DROP INDEX \`IDX_12f170faa137ca64b069468025\` ON \`wx_user\``);
        await queryRunner.query(`CREATE TABLE \`message\` (\`id\` int NOT NULL AUTO_INCREMENT, \`sender_id\` int NOT NULL, \`receiver_id\` int NOT NULL, \`content\` text NOT NULL, \`message_type\` enum ('user_to_doctor', 'doctor_to_user', 'topic_collected', 'doctor_verified') NOT NULL, \`send_time\` datetime NOT NULL, \`is_read\` tinyint NOT NULL DEFAULT 0, \`extra_data\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`DROP TABLE \`message\``);
        await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_12f170faa137ca64b069468025\` ON \`wx_user\` (\`doctorId\`)`);
    }

}
